package com.apps.realtyportal;

import com.jason.apps.buyer.EditMe;
import com.jason.apps.buyer.Favorites;
import com.jason.apps.buyer.Profile;
import com.jason.apps.dashboard.PersonDetail.Edit;
import com.jason.apps.fromdashboard.ForRent;
import com.jason.apps.fromdashboard.ForSale;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class MyFragmentPagerAdapter extends FragmentPagerAdapter {

	final int PAGE_COUNT = 4;

	/** Constructor of the class */
	public MyFragmentPagerAdapter(FragmentManager fm) {
		super(fm);

	}

	/** This method will be invoked when a page is requested to create */
	@Override
	public Fragment getItem(int arg0) {
		Bundle data = new Bundle();
		switch (arg0) {

		/** Android tab is selected */
		case 0:
			ForRent androidFragment = new ForRent();
			data.putInt("current_page", arg0 + 1);
			androidFragment.setArguments(data);
			return androidFragment;

			/** Apple tab is selected */
		case 1:
			ForSale appleFragment = new ForSale();
			data.putInt("current_page", arg0 + 1);
			appleFragment.setArguments(data);
			return appleFragment;

			/** Apple tab is selected */
		case 2:
			Favorites editFragment = new Favorites();
			data.putInt("current_page", arg0 + 1);
			editFragment.setArguments(data);
			return editFragment;
			/** Apple tab is selected */
		case 3:
			Profile favoritesFragment = new Profile();
			data.putInt("current_page", arg0 + 1);
			favoritesFragment.setArguments(data);
			return favoritesFragment;
		}

		return null;
	}

	/** Returns the number of pages */
	@Override
	public int getCount() {
		return PAGE_COUNT;
	}

}
